﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using Common;
using Basic.Model.Entity;
using Basic.Model.EntityManager;

namespace Basic.Business
{
    public class AutoNumberAdmin
    {
        #region 添加一个AutoNumber
        public static void AddAutoNumber(int currentNum, int initNum, string tableName)
        {
            ISession session = null;
            AutoNumber autoNumber = null;
            try
            {
                session = NHibernateHelper.OpenSession();
                autoNumber = new AutoNumber();
                autoNumber.currentNum = currentNum;
                autoNumber.initNum = initNum;
                autoNumber.tableName = tableName;
                AutoNumberManager.AddAutoNumber(session, autoNumber);
                session.Flush();
            }
            catch
            {
                throw;
            }
            finally
            {
                if (session != null)
                    session.Close();
            }
        }
        #endregion
    }
}
